package com.sjt.blog.interceptor;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @create: 2020-05-08-11-02
 * @author: Su Junting
 * @description: OSS配置文件，装载bean
 */
@Configuration
public class OssConfig {

    @Value("${aliyun.oss.endPoint}")
    private String ALIYUN_OSS_ENDPOINT;

    @Value("${aliyun.oss.accessKeyId}")
    private String ALIYUN_OSS_ACCESSKRYID;

    @Value("${aliyun.oss.accessKeySecret}")
    private String ALIYUN_OSS_ACCESSKRYSECRET;


    @Bean
    public OSS ossClient(){
        return new OSSClientBuilder().build(ALIYUN_OSS_ENDPOINT, ALIYUN_OSS_ACCESSKRYID, ALIYUN_OSS_ACCESSKRYSECRET);
    }

}
